<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- <input type="text" v-model="msg"> -->
        <div id="el"></div>
        <button onclick="fun()">点击</button>
    </div>
    <script src="./vue.js"></script>
    <script>
        // var newName = ''
        var params = {
            name: "张三",
            age: 15,
            tel: 110
        }
        document.getElementById('el').innerHTML  = params.name      
        
        
        // Object.defineProperty(params, 'name', {
        //     set(value) { 
        //         newName = value
        //         document.getElementById('el').innerHTML  = value
        //     },

        //     get() {
        //         return newName
        //     }
        // })
        
        // function fun() {
        //     params.name = "李四"
        //     console.log(params)
        // }

        Object.defineProperty(params, 'name', {
            value: "李四",
            enumerable: true, // 配置属性是否可枚举 值为true表示该属性可枚举
            writable: false, // 定义对象的属性是否可更改 值为true表示可以更改
            configurable: false  // 定义对象的属性是否可删除
        })
        // params.name = "王五"
        // console.log(params)
        // for(let key in params) {
        //     console.log(key)
        // }
        delete params['name']
        console.log(params)
        new Vue({
            data: {
                msg: ""
            },

            created() {
                
             },
        }).$mount('#app')
    </script>
</body>
</html>